from tkinter import Tk
from tkinter import Menu
import tkinter as tk

from database.member_function_admin.addmember import AddMember
from database.member_function_admin.admendmember import AdmendMember
from database.member_function_admin.deletemember import DeleteMember
from database.member_function_admin.searchmember import SearchMember

def MemberPage(): #会员信息
    admin_member_screen = Tk()
    admin_member_screen.title('会员信息管理')
    screen_width, screen_height = admin_member_screen.maxsize()
    # 窗口的宽和高
    width = 410
    height = 140
    centre = '%dx%d+%d+%d' % (width, height, (screen_width - width) / 2,
                              (screen_height - height) / 2)
    admin_member_screen.geometry(centre)
    welcome = tk.Label(admin_member_screen, text='请选择功能！', font=('楷体', 20))
    welcome.place(x=120, y=40)

    def add():
        AddMember()

    def amend():
        AdmendMember()

    def search():
        SearchMember()

    def delete():
        DeleteMember()

    def returnn():
        admin_member_screen.destroy()

    menu_member = Menu(admin_member_screen)
    menu_member.add_command(label='添加', command=add)
    menu_member.add_command(label='修改', command=amend)
    menu_member.add_command(label='查询', command=search)
    menu_member.add_command(label='删除', command=delete)
    menu_member.add_command(label='返回', command=returnn)

    admin_member_screen.config(menu=menu_member)

    admin_member_screen.mainloop()

if __name__ == '__main__':
    MemberPage()